import java.util.List;

public class Likou_fanzhuan {
    class ListNode{
        public ListNode next;
        public int val;
    }
    class Solution {
        public int kthToLast(ListNode head, int k) {
            ListNode cur=head;
            int count =0;
            while(cur!= null){
                count++;
                cur=cur.next;
            }
            cur=head;
            int a = count-k;
            while(a!=0){
                a--;
                cur=cur.next;
            }
            return cur.val;
        }
    }
}
